package com.test.service.impl;

import com.test.mapper.UserMapper;
import com.test.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @author 宋建华
 * @return
 * @date 2023-12-26
 */
@Service
public class UserService {
    @Autowired
    UserMapper userMapper;

    //这里的方式是usercontroller里的方法 然后从controller接受前端的参数 注入到service 然后到mapper
    public void insertUser(User user){
        userMapper.insertUser(user);
    }


    public void updateUser(User user) {
        userMapper.updateUser(user);
    }

    public void deleteUser(Integer id) {
        userMapper.deleteUser(id);
    }

    public void deleteUsers(List<Integer> ids) {
        userMapper.deleteUsers(ids);
    }

    public List<User> selectAll() {
        return userMapper.selectAll();
    }

    public User selectAllId(Integer id) {
        return userMapper.selectAllByid(id);
    }

    public List<User> selectListName(String name) {
        return userMapper.selectListName(name);
    }

    public List<User> selectByMore(String name, Integer id) {
        return userMapper.selectByMore(name,id);
    }

    public List<User> selectByMo(String username, String name) {
        return userMapper.selectByMo(username,name);
    }
}
